<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>鼠标悬停缩放动画</title>
    <link rel="stylesheet" href="./css/reset.css" />
    <style>
      .flower {
        width: 960px;
        /* height: 300px; */
        margin: 111px auto 0px;
      }

      .flower .item {
        width: 300px;
        height: 300px;
        background-color: pink;
        margin: 0px 10px;
        float: left;
        overflow: hidden;
        position: relative;
      }

      .clearfix::after {
        content: "";
        display: block;
        clear: both;
      }

      .item img {
        transition: transform ease 0.5s;
      }

      .item:hover img {
        transform: scale(1.2);
      }

      .item .item-mask {
        width: 300px;
        height: 300px;
        /* background-color: blue; */
        position: absolute;
        /* 补足边框造成的偏移 */
        top: -4px;
        left: -4px;
        transition: all ease 0.5s;
      }

      .item:hover .item-mask {
        transform: scale(0.8);
        background-color: rgba(0, 0, 0, 0.5);
        border: 4px solid #fff;
        box-shadow: 0 0 0 40px rgba(255, 255, 255, 0.5);
      }

      .item .title {
        position: absolute;
        top: 80px;
        left: 40px;
        right: 40px;
        font-size: 18px;
        color: #fff;
        z-index: 3;
        opacity: 0;
        transform: scale(1.2);
        transition: all ease 0.5s;
      }

      .item:hover .title {
        opacity: 1;
        transform: scale(1);
      }

      .item .info {
        position: absolute;
        top: 110px;
        left: 40px;
        right: 40px;
        font-size: 14px;
        color: #fff;
        z-index: 3;
        opacity: 0;
        transform: scale(1.2);
        transition: all ease 0.5s;
      }

      .item:hover .info {
        transform: scale(1);
        opacity: 1;
      }
    </style>
  </head>
  <body>
    <div class="flower clearfix">
      <div class="item">
        <img src="images/scale1.jpg" alt="image" />
        <div class="item-mask"></div>
        <div class="title">金凤蝶</div>
        <div class="info">
          这金凤蝶，Papilio machaon Linnaeus，又名黄凤蝶、茴香凤蝶、胡萝卜凤蝶，属鳞翅目，凤蝶科。因其体态华贵，花色艳丽而得名。 有“能飞的花朵”、“昆虫美术家”的雅号
        </div>
      </div>
      <div class="item">
        <img src="images/scale2.jpg" alt="image" />
        <div class="item-mask"></div>
        <div class="title">小黄菊</div>
        <div class="info">小黄菊（拉丁学名：Pyrethrum pulchrum Ledeb.）又名美丽匹菊，为菊科匹菊属多年生草本，高15-35厘米</div>
      </div>
      <div class="item">
        <img src="images/scale3.jpg" alt="image" />
        <div class="item-mask"></div>
        <div class="title">格桑花</div>
        <div class="info">格桑花又称格桑梅朵，具体为何种植物存在广泛的争议。在藏语中，“格桑”是“美好时光”或“幸福”的意思，“梅朵”是花的意思，所以格桑花也叫幸福花</div>
      </div>
    </div>
  </body>
</html>
